<template>
  <!--当使用swiper设置无效时，一定要检查版本号是否对应-->
  <!--检查两个版本号，一个是swiper另一个是vue-awesome-swiper-->
  <div class="wrapper">
    <swiper :options="swiperOptions">
      <swiper-slide>
        <img src="https://imgs.qunarzz.com/vs_ceph_vcimg/569cae4ae98e9793f7341e85eed73c54.jpeg" class="pic" alt="picture" />
      </swiper-slide>
      <swiper-slide>
        <img src="https://imgs.qunarzz.com/vs_ceph_vcimg/f03f5ac90ae59d0d9c6332a2bfd9782e.jpeg" class="pic" alt="picture" />
      </swiper-slide>
      <swiper-slide>
        <img src="https://imgs.qunarzz.com/vs_ceph_vcimg/1cfbdaa2682ada2f854ea6114b3677c8.jpeg" class="pic" alt="picture" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
/* 引入组件，不然会报错Unknown html tag swiper-slide */
import {Swiper, SwiperSlide} from 'vue-awesome-swiper'
export default {
  name: 'HomeTicket',
  components: {
    Swiper,
    SwiperSlide
  },
  data () {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination',
          loop: true,
          clickable: true,
          autoplay: {
            delay: 100,
            stopOnLastSlide: false
          }
        }
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
/* 设置轮播图导航标记的颜色 */
.wrapper >>> .swiper-pagination-bullet-active
  background: white
  /* 作用是预防抖动 */
.wrapper
  width: 100%
  height: 0
  padding-bottom: 31.25%
  overflow: hidden
  .pic
    width: 100%
</style>
